package org.example.testcode.bean;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.example.testcode.annotation.ESField;
import org.example.testcode.enumeration.ESAnalyzer;
import org.example.testcode.enumeration.ESFieldType;
import org.example.testcode.helper.IESMappingType;

import java.io.Serializable;
import java.lang.reflect.Field;

@Setter
@Getter
@ToString
public class EsGoodsInfo implements IESMappingType, Serializable {


    @ESField(fieldType = ESFieldType.LONG, analyzerType = ESAnalyzer.analyzed)
    private Long goodsInfoId;

    /**
     * 货品名称
     */
    @ESField(analyzerType = ESAnalyzer.standard, isStore = true)
    private String goodsInfoName;

    @Override
    public String generateDocId() {
        return (this.getGoodsInfoId() == null ? "" :
                this.getGoodsInfoId().toString());
    }

    @Override
    public Field[] foundTypeField() {
        return this.getClass().getDeclaredFields();
    }
}
